package com.example.swagger.exception;

import com.example.swagger.config.JsonResult;
import lombok.Data;

import java.text.MessageFormat;
import java.util.Locale;
import com.example.swagger.config.JsonResult;

/**
 * Http请求返回的错误信息
 */
@Data
public class GlobalError {
    private Integer code;
    private String zh_CN = "未知错误";
    private String en_US = "Unknown error";

    public static final GlobalError GLOBAL_OK = new GlobalError(0, "请求成功", "");

    // 安全模块错误码1-100
    public static final GlobalError PLATFORM_SECURITY_UNLOGIN = new GlobalError(1, "客户端未登录后台服务或已过期注销", "");

    public static final GlobalError PLATFORM_SECURITY_LOGIN_REPEAT = new GlobalError(2, "您的账号已在其他设备上登录，请重新登录", "");

    public static final GlobalError PLATFORM_SECURITY_TOKEN_TIMEOUT = new GlobalError(3, "access_token过期", "");

    public static final GlobalError PLATFORM_SECURITY_SIGNATURE_ERROR = new GlobalError(4, "签名错误", "");

    public static final GlobalError PLATFORM_SECURITY_INSUFFICIENT_PRIVILEGES = new GlobalError(5, "权限不足", "");

    public static final GlobalError PLATFORM_SECURITY_INSUFFICIENT_PRIVILEGES_SCALE = new GlobalError(6, "鉴权失败", "");

    public static final GlobalError PLATFORM_SECURITY_LOGIN_FAILED = new GlobalError(7, "用户名或密码错误", "");

    public static final GlobalError PLATFORM_SECURITY_USER_DISABLED = new GlobalError(8, "账号被禁用", "");

    public static final GlobalError PLATFORM_SECURITY_WRONG_OLD_PASSWORD = new GlobalError(9, "修改密码失败，旧密码不正确", "");

    public static final GlobalError PLATFORM_SECURITY_PWD_INVALID = new GlobalError(10, "密码设置不满足安全要求", "");

    public static final GlobalError PLATFORM_SECURITY_NAME_EXIST = new GlobalError(11, "用户名、手机号码或电子邮箱已存在", "");

    public static final GlobalError PLATFORM_SECURITY_CODE_TIMEOUT = new GlobalError(12, "请重新获取验证码", "");

    public static final GlobalError PLATFORM_SECURITY_CODE_ERROR = new GlobalError(13, "验证码输入错误", "");

    public static final GlobalError PLATFORM_SECURITY_CODE_UNCHECK = new GlobalError(14, "未通过短信验证", "");

    public static final GlobalError PLATFORM_SECURITY_PHONE_ERROR = new GlobalError(15, "手机号码已被使用", "");

    public static final GlobalError PLATFORM_SECURITY_USER_DELETED = new GlobalError(16, "用户已删除", "");

    public static final GlobalError PLATFORM_SECURITY_NAME_PHONE_EMAIL_SAME = new GlobalError(17, "用户名、手机号码或电子邮箱不允许输入相同值", "");

    public static final GlobalError GLOBAL_18 = new GlobalError(18, "该微信用户已绑定其他账号", "");

    public static final GlobalError PLATFORM_SECURITY_WRONG_PASSWORD = new GlobalError(19, "密码输入错误", "");

    public static final GlobalError PLATFORM_SECURITY_NO_SESSIONID = new GlobalError(20, "会话id不存在", "");

    public static final GlobalError PLATFORM_SECURITY_NO_LOGIN_VALIDATE = new GlobalError(21, "请重新进行登录验证流程", "");

    public static final GlobalError PLATFORM_SECURITY_USER_NOTFOUND = new GlobalError(22, "用户不存在", "");

    public static final GlobalError PLATFORM_SECURITY_UNLOGIN_ID = new GlobalError(23, "id为{0}的用户未登录", "");

    public static final GlobalError PLATFORM_SECURITY_FUNDACCOUNT_INVALID = new GlobalError(30, "资金账号密码已失效", "");

    public static final GlobalError PLATFORM_SECURITY_LOGIN_FAIL = new GlobalError(31, "登录失败，请重试！", "");

    // 公共错误码101-200
    public static final GlobalError GLOBAL_NOT_FOUND = new GlobalError(101, "记录不存在", "");

    public static final GlobalError GLOBAL_VERSION_CONFLICT = new GlobalError(102, "修改记录的版本冲突", "");

    public static final GlobalError GLOBAL_INPUT_ERROR = new GlobalError(103, "输入参数错误", "");

    public static final GlobalError GLOBAL_UNKNOWN = new GlobalError(104, "服务异常，请稍后再试", "");

    public static final GlobalError GLOBAL_UPLOAD_ERROR = new GlobalError(105, "上传文件失败", "");

    public static final GlobalError GLOBAL_JSON_ERROR = new GlobalError(106, "JSON对象转换异常", "");

    public static final GlobalError GLOBAL_NOT_IMPLEMENTED = new GlobalError(107, "后台服务功能尚未实现", "");

    public static final GlobalError GLOBAL_MAX_UPLOAD_SIZE_EXCEEDED = new GlobalError(108, "超过文件上传最大尺寸限制", "");

    public static final GlobalError GLOBAL_UPLOAD_FILE_TYPE_ERROR = new GlobalError(109, "上传文件格式不符合要求", "");

    public static final GlobalError GLOBAL_110 = new GlobalError(110, "文件已存在:{0}", "");

    public static final GlobalError GLOBAL_111 = new GlobalError(111, "文件不存在:{0}", "");

    public static final GlobalError GLOBAL_REDIS_CONNECTION_ERROR = new GlobalError(113, "Redis连接异常", "");

    public static final GlobalError GLOBAL_SMS_SEND_FAIL = new GlobalError(114, "发送短信失败", "");

    public static final GlobalError GLOBAL_HTTP_METHOD_NOTSUPPORTED = new GlobalError(115, "HTTP请求方法不支持", "");

    public static final GlobalError GLOBAL_JSON_REQUEST_RESPONSE_ERROR = new GlobalError(116, "输入JSON格式错误", "");

    public static final GlobalError GLOBAL_MYSQL_DUPLICATE_KEY = new GlobalError(117, "数据库主键冲突", "");

    public static final GlobalError GLOBAL_INPUT_NAME_ERROR = new GlobalError(118, "输入参数错误，参数名称为{0}", "");

    public static final GlobalError GLOBAL_INPUT_VALIDATE_ERROR = new GlobalError(119, "输入参数校验失败，{0}", "");

    public static final GlobalError GLOBAL_NOT_FOUND_ID = new GlobalError(120, "id为{0}的记录不存在", "");

    public static final GlobalError GLOBAL_CONNECT_TIMEOUT = new GlobalError(121, "内部网络超时", "");

    public static final GlobalError GLOBAL_DIRECTORY_NOT_FOUND = new GlobalError(122, "目录不存在:{0}", "");

    public static final GlobalError GLOBAL_DELETE_NOT_ALLOWED = new GlobalError(123, "id为{0}的记录不允许删除", "");

    public static final GlobalError GLOBAL_CONTENT_TYPE_ERROR = new GlobalError(124, "请求头部的Content type错误", "");

    public static final GlobalError GLOBAL_SERVICE_ERROR = new GlobalError(125, "调用远程服务失败", "");

    public static final GlobalError GLOBAL_SYSTEM_ERROR = new GlobalError(126, "服务异常，请稍后再试，错误码为{0}", "");

    public static final GlobalError GLOBAL_EXPORT_NOT_ALLOWED_OF_NO_DATA = new GlobalError(127, "当前查询无数据，不支持导出", "");

    public static final GlobalError GLOBAL_EXPORT_ERROR = new GlobalError(128, "导出失败", "");

    public static final GlobalError GLOBAL_SMS_MINUTE_LIMIT_ERROR = new GlobalError(129, "您当前请求短信次数太频繁，请稍后再试", "");

    public static final GlobalError GLOBAL_SMS_DAY_LIMIT_ERROR = new GlobalError(130, "您当日请求短信频率过高，请次日再来", "");

    public static final GlobalError GLOBAL_INSUFFICIENT_PRIVILEGES = new GlobalError(131, "需要授权：{0}", "");

    public static final GlobalError GLOBAL_EXPORT_DATA_TOO_MUCH = new GlobalError(132, "最多支持65536行数据导出，导出失败", "");

    public static final GlobalError GLOBAL_IMPORT_FILE_FORMAT_ERROR = new GlobalError(133, "上传文件格式不正确", "");

    public static final GlobalError GLOBAL_IMPORT_ERROR = new GlobalError(134, "导入失败", "");

    // 版本控制错误码201-300
    public static final GlobalError VERSION_CONTROL_APPLICATION_NOT_EXIST = new GlobalError(201, "版本控制数据库里没有相关信息", "");

    public static final GlobalError VERSION_CONTROL_VERSION_FORMAT_ERROR = new GlobalError(202, "版本格式不正确,请使用x.y.z作为版本格式  = new GlobalError(x,y,z都是整数)", "");

    public static final GlobalError VERSION_CONTROL_RESOURCE_ID_NOT_EXIST = new GlobalError(203, "当前resource id不存在，resource id = {0}", "");

    public static final GlobalError VERSION_CONTROL_DOWNLOAD_URL_ERROR = new GlobalError(204, "url格式错误", "");

    public static final GlobalError VERSION_CONTROL_APP_ID_NOT_EXIST = new GlobalError(205, "当前app id不存在，app id = {0}", "");

    public static final GlobalError VERSION_CONTROL_MD5_ERROR = new GlobalError(206, "md5格式不正确", "");

    public static final GlobalError VERSION_CONTROL_TIME_FORMAT_ERROR = new GlobalError(207, "日期格式错误，应该是yyyy-MM-dd HH:mm:ss", "");

    public static final GlobalError VERSION_CONTROL_PLATFORM_ERROR = new GlobalError(208, "platform错误，目前platform为{0},目前支持1-android，2-ios，3-android小程序，4-ios小程序", "");

    public static final GlobalError VERSION_CONTROL_FILE_SIZE_ERROR = new GlobalError(209, "file size 错误，应为 > 0, 现为 {0}", "");

    // 消息中心错误码301-400
    public static final GlobalError BUSINESS_MESSAGE_PUBLISH_MESSAGE_ID_REPEATED = new GlobalError(301, "messageId重复的记录，没有进行消息推送：{0}", "");

    public static final GlobalError BUSINESS_MESSAGE_PUBLISH_ANDROID_FAILED = new GlobalError(306, "推送安卓平台消息失败", "");

    public static final GlobalError BUSINESS_MESSAGE_PUBLISH_IOS_FAILED = new GlobalError(307, "推送IOS平台消息失败", "");

    public static final GlobalError BUSINESS_MESSAGE_CATALOG_NOT_FOUND = new GlobalError(308, "id为{0}的消息分类不存在", "");

    public static final GlobalError BUSINESS_MESSAGE_ALI_PUSH_ERROR = new GlobalError(309, "阿里push错误：{0}", "");

    public static final GlobalError BUSINESS_MESSAGE_IM_SEND_ERROR = new GlobalError(310, "IM邀请好友或发送消息失败", "");

    // 后台运营管理401-500
    public static final GlobalError BUSINESS_OPERATION_ENTRY_CATALOG_DEL_ERROR = new GlobalError(401, "分类下有图标数据，请删除后重试", "");

    // 新闻501-600
    public static final GlobalError BUSINESS_NEWS_INITIALIZE_NOT_READY = new GlobalError(501, "系统尚未准备好，请过会重试", "");

    // 需求管理601-700
    public static final GlobalError OPERATION_REQUIREMENT_ADVICE_BINDED_REQUIRMENT = new GlobalError(601, "该建议已关联需求，不允许删除", "");

    public static final GlobalError OPERATION_REQUIREMENT_EMOJIS_NOT_ALLOWED = new GlobalError(602, "不支持微表情符号！", "");

    // inner-paltform-security 701-800
    public static final GlobalError INNER_PLATFORM_SECURITY_PHONE_UNREGISTERED = new GlobalError(701, "您输入的手机号码未在系统中登记", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_PHONE_REGISTERED = new GlobalError(702, "您输入的号码已经在系统中登记过", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_ROLE_EXIST = new GlobalError(703, "该{0}在系统里已经存在", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_OPERATE_FAIL = new GlobalError(704, "{0} 操作失败！请重试！", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_NOT_DATA = new GlobalError(705, "未找到相关数据！", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_USERNAME_OR_PASSWORD_FAULT = new GlobalError(706, "用户名或密码错误！", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_ENCRYPT_FALL = new GlobalError(707, "{0}加密失败！", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_ORGINAZATION_NOT_FOUND = new GlobalError(708, "id为{0}的组织不存在", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_USERORG_SYNC_FAILED = new GlobalError(709, "同步用户和组织信息失败", "");

    public static final GlobalError INNER_PLATFORM_SECURITY_USER_APPLYING = new GlobalError(710, "您的申请正在处理中", "");

    public static final GlobalError INNER_BUSINESS_IM_LOGIN_FAIL = new GlobalError(711, "IM登录失败", "");

    // 积分商城801-900
    public static final GlobalError BUSINESS_CREDIT_MALL_CHECK_IN_FAIL = new GlobalError(801, "已签到，请勿重复签到", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_TASK_FAIL = new GlobalError(802, "创建任务/活动失败,原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_TASK_FAIL = new GlobalError(803, "更新任务/活动失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_DELETE_TASK_FAIL = new GlobalError(804, "删除任务/活动失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_USER_TASK_RECORD_FAIL = new GlobalError(804, "新增用户任务完成记录失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_USER_NOT_EXIST = new GlobalError(805, "用户不存在", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_USER_FAIL = new GlobalError(806, "创建用户失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_GET_TASK_FAIL = new GlobalError(807, "任务/活动不存在", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_USER_FAIL = new GlobalError(808, "更新用户信息失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_USER_CREDIT_RECORD_FAIL = new GlobalError(809, "新增用户积分记录流水失败", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CHECK_FREQUENCY_LIMIT_ERROR = new GlobalError(810, "任务/活动超过频率限制", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_DELETE_TASK_FAIL_FOR_TASK_CARD = new GlobalError(811, "该任务/活动关联上架中的积分卡片，不允许删除", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_STOCK_MISSING = new GlobalError(812, "找不到相关库存id，id为{0}，请联系开发运维人员", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_STOCK_CHANGE_RECORD_FAIL = new GlobalError(813, "插入库存变动记录失败,原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_STOCK_FAIL = new GlobalError(814, "更新库存失败，原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_DELETE_TASK_FAIL_FOR_USER_TASK_RECORD = new GlobalError(815, "该任务关联有用户任务完成记录，不允许删除", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_STOCK_DETAIL_MISSING = new GlobalError(816, "找不到库存详情，id为{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CHECK_PERSON_MAX_LIMIT_ERROR = new GlobalError(817, "超过最大参与次数限制", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_TASK_CARD_FAIL = new GlobalError(818, "创建任务/活动卡片失败,原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_TASK_CARD_FAIL = new GlobalError(819, "修改任务/活动卡片失败,原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_STOCK_DETAIL_EXIST = new GlobalError(820, "库存详情已存在，stock_id={0}, supplier={1}, batch_number={2}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_SEARCH_FAIL = new GlobalError(821, "不支持的过滤条件，原因：{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREDIT_MUST_EQUAL_OR_LESS_THEN_USER_CREDIT = new GlobalError(822, "用户积分数小于消耗积分数", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CREATE_PRODUCT_FAIL = new GlobalError(823, "新建卡片失败失败, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_PRODUCT_FAIL = new GlobalError(824, "更新卡片失败失败, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_DELETE_PRODUCT_FAIL = new GlobalError(825, "删除卡片失败失败, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_CANNOT_FIND_PRODUCT_CATEGORY = new GlobalError(826, "找不到当前卡片分类，分类信息是{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_READ_PRODUCT_FAIL = new GlobalError(827, "读取卡片记录失败, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_READ_STOCK_FAIL = new GlobalError(828, "读取库存记录失败, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UNDERSTOCK = new GlobalError(828, "库存不足, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_ADDR_ERROR = new GlobalError(829, "用户地址服务异常, 原因:{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_ORDER_ERROR = new GlobalError(830, "订单服务异常, 原因:{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_REPORT_PARAMS = new GlobalError(831, "app上报错误, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_REPORT_URL = new GlobalError(832, "app上报错误, 原因{0}", "");

    public static final GlobalError BUSINESS_CREDIT_MALL_UPDATE_PRODUCT_STOCK_DETAIL_FAIL = new GlobalError(833, "更新库存明细失败, id:{0}", "");

    // business-bigdata 1001-1100
    public static final GlobalError INNER_BUSINESS_BIGDATA_SEND_ERROR = new GlobalError(1001, "请求大数据接口失败", "");

    public static final GlobalError INNER_BUSINESS_BIGDATA_USERCODE_NOT_FOUND = new GlobalError(1002, "客户账号不存在", "");

    // inner-business-activity 1101-1200
    public static final GlobalError INNER_BUSINESS_ACTIVITY_NOT_EXISTS = new GlobalError(1101, "id为{0}的活动不存在", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_STARTTIME_LESS_THAN_ENDTIME = new GlobalError(1102, "开始时间必须小于结束时间", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_ACTIVITY_STARTTIME_LESS_THAN_ENDTIME = new GlobalError(1103, "活动开始时间必须小于活动结束时间", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_PARAM_MUST_NOT_BE_EMPTY = new GlobalError(1104, "必须输入至少一项查询条件", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_EXPORT_ERROR = new GlobalError(1105, "导出失败", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_ACTIVITY_IN_PROCESS_ALERT = new GlobalError(1106, "活动在上架中，确定删除？", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_ACTIVITY_SHARE_NOT_EXISTS = new GlobalError(1107, "用户id为{0}分享id为{1}的活动不存在", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_ACTIVITY_ID_EXISTS = new GlobalError(1108, "活动标识已存在", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_SHENCE_RESPONSE_ERROR = new GlobalError(1109, "神策响应失败", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_NOT_EXISTS_BY_ACTIVITY_ID = new GlobalError(1110, "标识为{0}的活动不存在", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_SHENCE_DATA_STRUCTURE_CHANGES = new GlobalError(1111, "神策数据结构发生变化导致数据解析错误", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_ACTIVITY_OFF_ERROR = new GlobalError(1112, "状态为未上架或者上架中的活动才允许下架，id为{0}的当前活动状态为{1}", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_USERID_ERROR = new GlobalError(1113, "用户ID输入错误", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_PHASE_EMPTY_ERROR = new GlobalError(1114, "活动期数不能为空", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_PHASE_ONE_EMPTY_ERROR = new GlobalError(1115, "第{0}期，活动开始时间或者活动结束时间不能为空", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_PHASE_ONE_STARTTIME_LESS_THAN_ENDTIME = new GlobalError(1116, "活动第{0}期开始时间必须小于结束时间", "");

    public static final GlobalError INNER_BUSINESS_ACTIVITY_PHASE_ONE_STARTTIME_MUST_EQUAL_LAST_ENDTIME = new GlobalError(1117, "活动第{0}期的开始时间必须等于上一期的结束时间", "");

    // 查询资金账号错误码40151-40200
    public static final GlobalError MINIAPP_FUNDACCOUNT_UNREGISTERED = new GlobalError(40151, "此身份证号未注册，请重新输入！", "");

    public static final GlobalError MINIAPP_FUNDACCOUNT_PHONE_UNMATCH = new GlobalError(40152, "与开户预留手机号不符，请重新输入！", "");

    // 风险测评错误码40201-40250
    public static final GlobalError MINIAPP_RISKEVALUATE_UNREGISTERED = new GlobalError(40201, "该账号在系统内尚未开户", "");

    public static final GlobalError MINIAPP_RISKEVALUATE_UNDONE = new GlobalError(40202, "尚未完成风险测评，请立即测评", "");


    // 修改主股东错误码40251-40300
    public static final GlobalError MINIAPP_MAINSHAREHOLDER_UPDATE_FALSE = new GlobalError(40251, "修改主股东失败", "");

    public static final GlobalError MINIAPP_MAINSHAREHOLDER_IS_MAIN = new GlobalError(40252, "该账户已经是主股东", "");

    public static final GlobalError MINIAPP_MAINSHAREHOLDER_QUERY_NULL = new GlobalError(40253, "该账户下目前还未挂载深A和沪A股东", "");

    //身份证有效期修改40301-40350
    public static final GlobalError MINIAPP_IDCARDMODIFY_PHOTO_OCR_FAILURE = new GlobalError(40301, "身份证信息读取失败，请重新上传图片", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_PHOTO_FRONT_FAILURE = new GlobalError(40302, "抱歉，无法正确读取身份证正面信息，请重新上传身份证正面照片", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_PHOTO_BACK_FAILURE = new GlobalError(40303, "抱歉，无法正确读取身份证反面信息，请重新上传身份证反面照片", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_CHECKOUT_FRONT_FAILURE = new GlobalError(40304, "照片读取错误，身份证正面身份证号或姓名与开户的信息不一致，请重新上传身份证正面照", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_CHECKOUT_VALIDITY_FAILURE = new GlobalError(40305, "您的年龄和身份证有效时间不符合，请核对身份证背面有效期限，重新上传身份证照片", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_PHOTO_UPLOAD_FAILURE = new GlobalError(40306, "照片上传失败，请核实后重新上传", "");

    public static final GlobalError MINIAPP_IDCARDMODIFY_INFO_UPDATE_FAILURE = new GlobalError(40307, "资料修改失败,请核实后重新输入", "");

    //密码重置小程序40351-40400
    public static final GlobalError MINIAPP_PASSWORDRESET_UNREGISTERED = new GlobalError(40351, "该账号在系统内尚未开户，请核实后重新输入！", "");

    public static final GlobalError MINIAPP_PASSWORDRESET_UNMATCH = new GlobalError(40352, "与开户时身份证不符，请核实后重新输入！", "");

    public static final GlobalError MINIAPP_PASSWORDRESET_PASSWORD_INPUT_ERROR = new GlobalError(40353, "交易密码输入不全或为空，请重新输入", "");

    public static final GlobalError MINIAPP_PASSWORDRESET_PASSWORD_SIMPLE = new GlobalError(40354, "您的密码设置过于简单，请重新输入", "");

    //港股通
    public static final GlobalError MINIAPP_HONGKONGSHARES_SHAREHOLDER_NULL = new GlobalError(40351, "您的账户下目前还未挂载{0}股东号", "");

    public static final GlobalError MINIAPP_HONGKONGSHARES_RISKLEVEL_QUERY_ERROR = new GlobalError(40352, "查询风险级别错误", "");

    //融资融券
    public static final GlobalError MINIAPP_RZRQ_LOGIN_FAILURE = new GlobalError(40401, "融资融券登录失败", "");

    public static final GlobalError MINIAPP_RZRQ_LOGIN_INVALID = new GlobalError(40402, "登录失效，请重新登录", "");

    public static final GlobalError MINIAPP_RZRQ_ADJUST_AMOUNT_ERROR = new GlobalError(40403, "申请额度错误，{0}", "");


    // miniapp 全局异常
    public static final GlobalError MINIAPP_GLOBAL_UPG_ERROR = new GlobalError(59993, "{0}", "");

    public static final GlobalError MINIAPP_GLOBAL_UPG_READ_TIMEOUT = new GlobalError(59994, "upg响应超时", "");

    public static final GlobalError MINIAPP_GLOBAL_REQUEST_UPG_ERROR = new GlobalError(59995, "抱歉！UPG请求失败！{0}", "");

    public static final GlobalError MINIAPP_GLOBAL_NO_FUNDACCOUNT = new GlobalError(59996, "获取资金账号失败，请重新登录交易账号", "");

    public static final GlobalError MINIAPP_GLOBAL_GET_FUNDACCOUNT_ERROR = new GlobalError(59997, "查询资金账号错误", "");

    public static final GlobalError MINIAPP_GLOBAL_AUTHENTICATION_FAIDURE = new GlobalError(59998, "用户认证失败", "");

    public static final GlobalError MINIAPP_GLOBAL_QUERY_ERROR = new GlobalError(59999, "获取信息失败!{0}", "");

    public static final GlobalError MINIAPP_GLOBAL_UPG_REQUEST_TIMEOUT = new GlobalError(60000, "upg请求连接超时", "");


    public static final GlobalError REQUEST_BIGDATA_ERROR = new GlobalError(60000, "feign调用大数据接口发生异常", "");
    public static final GlobalError REQUEST_BIGDATA_SIGN_ERROR = new GlobalError(60001, "大数据的鉴权异常", "");


    public GlobalError(int code, String zhMessage, String enMessage) {
        this.code = code;
        this.zh_CN = zhMessage;
        this.en_US = enMessage;
    }

    public String formatZh_CN(Object... messages) {
        if (messages != null && messages.length > 0) {
            if (zh_CN != null) {
                return MessageFormat.format(zh_CN, messages);
            }
        }
        return zh_CN;
    }

    public String formatEn_US(Object... messages) {
        if (messages != null && messages.length > 0) {
            if (en_US != null) {
                return MessageFormat.format(en_US, messages);
            }
        }
        return en_US;
    }

}
